package com.zrm.zfcrpa.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class MajarKeyUtils {
	
	
	/**
	 * 生成32位主键UUID
	 */
	public static String createUUID() {
		return UUID.randomUUID().toString().replaceAll("-", "");
	}

	
	/**
	 * 生成20位流水号,规则:日期yyyyMMddHHmmss+6位随机数
	 */
	public static String createTwentyCode() {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		String date_string = dateFormat.format(new Date());
		int rand = new Double((Math.random()+1) * 100000).intValue();
		return date_string + rand;
	}


	/**
	 * 生成23位流水号,规则:日期yyyyMMddHHmmssSSS+6位随机数
	 */
	public static String createTwentyThreeCode() {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		String date_string = dateFormat.format(new Date());
		int rand = new Double((Math.random()+1) * 100000).intValue();
		return date_string + rand;
	}
	
	
	

}
